/*!
* @file Axis.cpp
* @brief 三维轴
* @date 2024/9/12
*/
#include "Axis.h"
#include "Placement.h"

using namespace data;

void Axis::Reverse()
{
    dir = -dir;
}

Axis Axis::Reversed() const
{
    Axis axis(*this);
    axis.Reverse();
    return axis;
}

void Axis::Move(const Vector3d& vec)
{
    base += vec;
}

Axis& Axis::Set(const Vector3d& base, const Vector3d& dir)
{
    this->base = base;
    this->dir = dir;
    return *this;
}

bool Axis::operator==(const Axis& axis) const
{
    return (base == axis.base) && (dir == axis.dir);
}

bool Axis::operator!=(const Axis& axis) const
{
    return !(*this == axis);
}

Axis Axis::operator*(const Placement& plm) const
{
    Axis axis(*this);
    axis *= plm;
    return axis;
}

Axis& Axis::operator*=(const Placement& plm)
{
    base *= plm;
    dir *= plm.rotation;
    return *this;
}
